﻿namespace GoodAdmin.System;

public interface ISysJobService
{
    /// <summary>
    /// 获取作业分页列表
    /// </summary>
    Task<SqlSugarPagedList<JobDetailOutput>> PageJobDetail(JobDetailPageInput input);
    /// <summary>
    /// 添加作业
    /// </summary>
    /// <returns></returns>
    Task AddJobDetail(JobDetailInput input);

    /// <summary>
    /// 更新作业
    /// </summary>
    /// <returns></returns>
    Task UpdateJobDetail(JobDetailInput input);

    /// <summary>
    /// 删除作业
    /// </summary>
    /// <returns></returns>
    Task DeleteJobDetail(JobDetailIdInput input);

    /// <summary>
    /// 获取触发器列表
    /// </summary>
    Task<List<SysJobTrigger>> GetJobTriggerList([FromQuery] JobDetailIdInput input);

    /// <summary>
    /// 添加触发器
    /// </summary>
    /// <returns></returns>
    Task AddJobTrigger(JobTriggerInput input);
    /// <summary>
    /// 更新触发器
    /// </summary>
    /// <returns></returns>
    Task UpdateJobTrigger(JobTriggerInput input);

    /// <summary>
    /// 删除触发器
    /// </summary>
    /// <returns></returns>
    Task DeleteJobTrigger(JobTriggerIdInput input);

    /// <summary>
    /// 暂停所有作业
    /// </summary>
    /// <returns></returns>
    public void PauseAllJob();

    /// <summary>
    /// 启动所有作业
    /// </summary>
    /// <returns></returns>
    public void StartAllJob();

    /// <summary>
    /// 暂停作业
    /// </summary>
    public void PauseJob(JobDetailIdInput input);

    /// <summary>
    /// 启动作业
    /// </summary>
    public void StartJob(JobDetailIdInput input);

    /// <summary>
    /// 取消作业
    /// </summary>
    public void CancelJob(JobDetailIdInput input);

    /// <summary>
    /// 执行作业
    /// </summary>
    /// <param name="input"></param>
    public void RunJob(JobDetailIdInput input);

    /// <summary>
    /// 暂停触发器
    /// </summary>
    public void PauseTrigger(JobTriggerIdInput input);

    /// <summary>
    /// 启动触发器
    /// </summary>
    public void StartTrigger(JobTriggerIdInput input);


    /// <summary>
    /// 强制唤醒作业调度器
    /// </summary>
    public void CancelSleep();

    /// <summary>
    /// 强制触发所有作业持久化
    /// </summary>
    public void PersistAll();

    /// <summary>
    /// 获取作业触发器运行记录分页列表
    /// </summary>
    Task<SqlSugarPagedList<SysJobTriggerRecord>> PageJobTriggerRecord(JobTriggerRecordPageInput input);
}
